<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="exNumber" label="展馆号"> </el-table-column>
      <el-table-column prop="standNum" label="展位号"> </el-table-column>
      <el-table-column prop="standName" label="展位名称"> </el-table-column>
      <el-table-column prop="constructionName" label="搭建公司">
      </el-table-column>
<!--      <el-table-column prop="standName" label="参展商"> </el-table-column>-->
      <el-table-column label="报馆进度" align="center" prop="applyStep">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.ex_apply_step" :value="scope.row.applyStep"/>
        </template>
      </el-table-column>
      <el-table-column label="审图状态" align="center" prop="applyStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.apply_status" :value="scope.row.applyStatus"/>
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="申请时间"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="uplaod(scope.row)" type="text">修改</el-button>
          <el-button type="text" style="color: #ff0000">删除</el-button>
          <el-button @click="hanldpath(scope.row)" type="text">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
            v-show="total>0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getdata"
    />
  </div>
</template>
<script>
import { getlist, apply } from "@/api/outfit/drawingadd.js";
import { getToken, setToken, removeToken } from "@/utils/auth";
export default {
  dicts: ['apply_status', 'ex_apply_step'],
  data() {
    return {
      tableData: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        applyPerson: null,
        exhibitionId: null,
      },
      total: 0,
    };
  },
  activated() {
    removeToken("applyid");
    this.queryParams.applyPerson = getToken("username");
    this.getdata();
  },
  methods: {
    getdata() {
      var exhibion = JSON.parse(getToken("exhibition"));
      this.queryParams.exhibitionId = exhibion.id;
      getlist(this.queryParams).then((res) => {
        if (res.code == 200) {
          this.tableData = res.rows;
          this.total = res.total;
        }
      });
    },
    hanldpath(row) {
      console.log(row);
      this.$router.push({
        path: "/drawingdetail",
        query: {
          id: row.id,
        },
      });
    },
    uplaod(row) {
      setToken("applyid", row.id);
      apply(row.id).then((res) => {
        setToken("jd", JSON.stringify(res.data));
        setToken("stan", JSON.stringify(res.data.exhibitioinStandInfo));
        setToken("stanId", null);
        this.$router.push({
          path: "/drawingadd",
          query: {
            index: res.data.reportCadApply.applyStep,
          },
        });
      });
    },
  },
};
</script>
<style scoped>
/deep/.el-table th.el-table__cell {
  background-color: #f8fcfc !important;
  text-align: center !important;
}
/deep/.el-table td.el-table__cell,
.el-table th.el-table__cell.is-leaf {
  text-align: center !important;
}
</style>